package com.learn.pass;

public class IsPalindrome {
    public boolean isPalindrome(int x) {
        if (x < 0) return false;
        else if (x >= 0 && x < 10) return true;
        int cp = x;
        int reverse = 0;
        while (cp != 0) {
            reverse = reverse * 10 + cp % 10;
            cp /= 10;
        }
        return reverse == x;
    }
}
